package cn.wolfcode.wolf2world.web.controller;

import cn.wolfcode.wolf2world.utils.LoadFileUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 杨兴健
 * @Date 2020/8/12 14:56
 */
@Controller
public class UploadController {

    @RequestMapping("/uploadImg")
    @ResponseBody
    public Object uploadImg(MultipartFile pic) throws Exception {
        //TODO 上传图片
        String url = LoadFileUtil.uploadAli(pic);
        return url;
    }


    @RequestMapping("/uploadImg_ck")
    @ResponseBody
    public Object uploadImg_ck(MultipartFile upload) throws Exception {
        //TODO 上传图片
        String url = LoadFileUtil.uploadAli(upload);
        Map<String, String> map = new HashMap<>();
        map.put("uploaded","1");
        map.put("url",url);
        return map;
    }

}
